package com.itheima.HomeWork.homework03;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo {
    public static void main(String[] args) {
        HashMap<Integer, String> map = new HashMap<>();
        map.put(1,"张三");
        map.put(2,"李四");
        map.put(10,"王五");
        System.out.println(map.size());
        System.out.println("-------------------------------------");
        Set<Integer> integers = map.keySet();
        for (Integer integer : integers) {
            String s = map.get(integer);
            System.out.println(integer+":"+s);
        }
        System.out.println("-------------------------------------");
        Set<Map.Entry<Integer, String>> entries = map.entrySet();
        for (Map.Entry<Integer, String> entry : entries) {
            Integer key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+":"+value);
        }
        System.out.println("-------------------------------------");
        System.out.println(map.get(1));
        System.out.println(map.get(10));
        System.out.println(map.containsKey(10));
        map.remove(1);
        Set<Integer> integers1 = map.keySet();
        for (Integer i : integers1) {
            String s = map.get(i);
            System.out.println(i+":"+s);
        }
    }
}
